import 'package:flutter/material.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import '../model/cabinet_form_earnings_info_model.dart';

class CabinetFormEarningsInfoItem extends StatelessWidget {
  final CabinetFormEarningsInfoModel? itemModel;
  final Color? color;
  final Color? backColor;
  const CabinetFormEarningsInfoItem({
    super.key,
    this.itemModel,
    this.color,
    this.backColor,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: (backColor != null) ? backColor : MGColors.backColor,
        borderRadius: BorderRadius.circular(6),
      ),
      child: Flex(
        direction: Axis.horizontal,
        children: [
          Expanded(
              flex: 1,
              child: Container(
                padding: EdgeInsets.only(top: 20, bottom: 20, left: 16, right: 16),
                child: Text(
                  (itemModel != null) ? (itemModel!.displayNo ?? "") : "柜机编号",
                  style: TextStyle(color: color ?? MGColors.text3Color),
                ),
              )),
          Expanded(
              flex: 2,
              child: Text(
                (itemModel != null) ? (itemModel!.deviceName ?? "") : "站点名称",
                textAlign: TextAlign.center,
                style: TextStyle(color: color ?? MGColors.text3Color),
              )),
          Expanded(
              flex: 1,
              child: Container(
                padding: EdgeInsets.only(top: 20, bottom: 20, left: 16, right: 16),
                child: Text(
                  (itemModel != null) ? (itemModel!.totalIncome ?? 0).toStringAsFixed(2) : "收益",
                  style: TextStyle(color: color ?? MGColors.text3Color),
                ),
              )),
        ],
      ),
    );
  }
}
